package com.fz.us.oa.core.entity.com;

import com.fz.us.admin.company.entity.BaseFlowEntity;
import com.fz.us.admin.company.entity.User;
import com.fz.us.admin.dict.entity.DictItem;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * Created by ZhuChunXiao on 2017/5/25.
 */
@Entity
@Table(name="ec_train")
public class Train extends BaseFlowEntity {
    private static final long serialVersionUID = -2832141990087702683L;
    /**
     * 培训主题
     */
    private String theme;
    /**
     * 培训类型
     */
    private DictItem type;
    /**
     * 培训内容
     */
    private String content;
    /**
     * 培训周期开始
     */
    private Date cycleStart;
    /**
     * 培训周期结束
     */
    private Date cycleEnd;
    /**
     * 培训讲师
     */
    private String lecturer;
    /**
     * 参与人员
     */
    private List<User> joinUsers;
    /**
     * 培训总结
     */
    private String summary;
    /**
     * 取消原因
     */
    private String cancelReason;
    /**
     * 是否结束
     */
    private boolean finish;
    /**
     * 结束状态 1已完成 2已取消
     */
    private int finishState;

    public String getTheme() {
        return theme;
    }

    public void setTheme(String theme) {
        this.theme = theme;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public DictItem getType() {
        return type;
    }

    public void setType(DictItem type) {
        this.type = type;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getCycleStart() {
        return cycleStart;
    }

    public void setCycleStart(Date cycleStart) {
        this.cycleStart = cycleStart;
    }

    public Date getCycleEnd() {
        return cycleEnd;
    }

    public void setCycleEnd(Date cycleEnd) {
        this.cycleEnd = cycleEnd;
    }

    public String getLecturer() {
        return lecturer;
    }

    public void setLecturer(String lecturer) {
        this.lecturer = lecturer;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getCancelReason() {
        return cancelReason;
    }

    public void setCancelReason(String cancelReason) {
        this.cancelReason = cancelReason;
    }

    @Column(columnDefinition = "tinyint(1) default 0")
    public boolean isFinish() {
        return finish;
    }

    public void setFinish(boolean finish) {
        this.finish = finish;
    }

    public int getFinishState() {
        return finishState;
    }

    public void setFinishState(int finishState) {
        this.finishState = finishState;
    }

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "ec_train_users", joinColumns = @JoinColumn(name="id"),inverseJoinColumns = @JoinColumn(name="userId"))
    public List<User> getJoinUsers() {
        return joinUsers;
    }

    public void setJoinUsers(List<User> joinUsers) {
        this.joinUsers = joinUsers;
    }

}
